#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
int n, r[MAXN], ans = 0x7f7f7f;
bool vis[MAXN] = {false};

void solve() {
    for (int i = 1; i <= n; i++) {
        // memset(vis, false, sizeof(vis));
        for (int j = 1; j <= n; j++) {
            int mon = n;
            if (r[i] < r[j] || i == j || vis[j] == true) continue;
            if (r[i] >= r[j]) {
                vis[j] = true;
                solve();
                mon--;
                vis[j] = false;
            }
            ans = min(mon, ans);
        }
    }
}

int main() {
    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> r[i];
    }
    r[n+1] = INT_MAX;
    solve();
    cout << ans << endl;

    return 0;
}